﻿// =====================================================================
//
//  This file is part of the Microsoft Dynamics CRM SDK code samples.
//
//  Copyright (C) Microsoft Corporation.  All rights reserved.
//
//  This source code is intended only as a supplement to Microsoft
//  Development Tools and/or on-line documentation.  See these other
//  materials for detailed information regarding Microsoft code samples.
//
//  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//
// =====================================================================
using System.Runtime.Serialization;

namespace Microsoft.Xrm.Sdk.Metadata
{
	[DataContract(Name = "OptionMetadata", Namespace = XmlNamespaces.V5.Metadata)]
	[KnownType(typeof(StateOptionMetadata))]
	[KnownType(typeof(StatusOptionMetadata))]
	public class OptionMetadata : MetadataBase
	{
		private int? _optionValue;
		private Label _label;
		private Label _description;
		private bool? _isManaged;

		public OptionMetadata()
			: base()
		{
		}

		public OptionMetadata(int value)
			: this()
		{
			this.Value = value;
		}

		public OptionMetadata(Label label, int? value)
		{
			this.Label = label;
			this.Value = value;
		}

		[DataMember]
		public int? Value
		{
			get { return this._optionValue; }
			set { this._optionValue = value; }
		}

		[DataMember]
		public Label Label
		{
			get { return this._label; }
			set { this._label = value; }
		}

		[DataMember]
		public Label Description
		{
			get { return this._description; }
			set { this._description = value; }
		}

		[DataMember]
		public bool? IsManaged
		{
			get { return this._isManaged; }
			internal set { this._isManaged = value; }
		}
	}
}
